home *** CD-ROM | disk | FTP | other *** search
/ PsL Monthly 1993 December / PSL Monthly Shareware CD-ROM (December 1993).iso / prgmming / dos / pascal / gsdbloo.exe / DEMOE001.PAS < prev    next >
Pascal/Delphi Source File  |  1992-02-24  |  3KB  |  81 lines

  1. program DemoE001;
  2. {------------------------------------------------------------------------------
  3.                               DBase File Display
  4.                               Expanded Sample 1
  5.                                  Demo Program
  6.  
  7.        Copyright (c)  Richard F. Griffin
  8.  
  9.        10 February 1992
  10.  
  11.        102 Molded Stone Pl
  12.        Warner Robins, GA  31088
  13.  
  14.        -------------------------------------------------------------
  15.        Display all record fields on-screen.
  16.  
  17.        **********  Not For Use in a TurboVision Environment  **********
  18.  
  19.        If it does not already exist, the DEMOE1.DBF file will be created
  20.        by using the MakeTestData procedure in GS_GENF.PAS.
  21.  
  22.        All fields in the dBase record will be displayed on-screen using
  23.        the FieldDisplay procedure in GS_dBFld_Objt.
  24.  
  25.        The WaitForKey procedure from GS_KEYI.PAS is also demonstrated as
  26.        a simple call to wait for a key press (and clear the pressed key).
  27.  
  28. -------------------------------------------------------------------------------}
  29. uses
  30.    CRT,
  31.    DOS,
  32.    GS_KeyI,
  33.    GS_dBFld,
  34.    GS_dBase,
  35.    GS_FileH,
  36.    GS_GenF;
  37. var
  38.    MyFile  : GS_dBFld_Objt;
  39.    CkFile  : file;
  40.  
  41. procedure DisplayRecord;
  42. begin
  43.   MyFile.FieldDisplay('LASTNAME','Last Name: ',1,1);
  44.    MyFile.FieldDisplay('FIRSTNAME','First Name, Middle Initial: ',1,2);
  45.    MyFile.FieldDisplay('STREET','Street Address: ',1,3);
  46.    MyFile.FieldDisplay('OFFICE','Building, suite, etc: ',1,4);
  47.    MyFile.FieldDisplay('CITY','City: ',1,5);
  48.    MyFile.FieldDisplay('STATE','State: ',1,6);
  49.    MyFile.FieldDisplay('ZIP','Zip Code: ',1,7);
  50.    MyFile.FieldDisplay('TELEPHONE','Telephone Number: ',1,8);
  51.    MyFile.FieldDisplay('BIRTHDATE','Date of Birth: ',1,9);
  52.    MyFile.FieldDisplay('PAYMENT','Payment Amount: ',1,10);
  53.    MyFile.FieldDisplay('PAIDFLAG','Amount Was Paid?: ',1,11);
  54.    MyFile.FieldDisplay('RANDOMNUM','Random Number: ',1,12);
  55. end;
  56.  
  57. begin
  58.    ClrScr;
  59.  
  60.    if not GS_FileExists(CkFile,'DEMOE1.DBF') then
  61.    begin
  62.       writeln('Creating DemoE1.DBF');
  63.       MakeTestData('DemoE1', 20, false);
  64.       writeln('DemoE1.DBF Created');
  65.       ClrScr;
  66.    end;
  67.    GotoXY(1,15);
  68.    write('Press ESC to stop, any other key to continue');
  69.    MyFile.Init('DEMOE1');
  70.    MyFile.Open;
  71.    MyFile.GetRec(Top_Record);
  72.    while not MyFile.File_EOF do
  73.    begin
  74.       DisplayRecord;
  75.       WaitForKey;
  76.       if GS_KeyI_Chr = Kbd_Esc then halt;
  77.       MyFile.GetRec(Next_Record);
  78.    end;
  79.    MyFile.Close;
  80. end.
  81.